package com.onefinger.manager.managers
{
	import com.onefinger.manager.views.model.BaseCRUDModel;
	import com.onefinger.manager.views.model.CategoryCRUDModel;
	import com.onefinger.manager.vos.Category;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	import mx.collections.ArrayCollection;

	public class CategoryManager extends BaseManager
	{
		
		//--------------------------------------------------------------------
		//    Public Setters and Getters
		//--------------------------------------------------------------------
		
		
		//.................categories......................
		private var _categories:ArrayCollection;

		[Bindable(event="changeCategories")]	
		public function get categories():ArrayCollection
		{
			return _categories;
		}

		public function setCategories(value:ArrayCollection):void
		{
			_categories = value;
			dispatchEvent( new Event( "changeCategories" ) );
		}
		
		public function addCategory(value:Category):void
		{
			_categories.addItem(value);
			dispatchEvent( new Event( "changeCategories" ) );
		}
		//.................Category......................
		private var _category:Category=new Category();
		
		[Bindable(event="changeCategory")]
		public function get category():Category
		{
			return _category;
		}
		public function setCategory(value:Category):void
		{
			_category = value;
			dispatchEvent( new Event( "changeCategory" ) );
		}
		public function selectCategory(value:Category):void
		{
			_category = value;
			dispatchEvent( new Event( "changeCategory" ) );
		}
	}
}